//
//  WalletTiXianVC.m
//  NtoccShipper
//
//  Created by zcj on 2021/9/17.
//  Copyright © 2021 zhuchongjin. All rights reserved.
//

#import "WalletTiXianVC.h"

@interface WalletTiXianVC ()
@property (nonatomic,strong) CJTextField *tfTiXianMoney;
@property (nonatomic,strong) FlexTextView *tvRemark; // 备注
@end

@implementation WalletTiXianVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self setTitleName:@"提现申请"];
    [self setBackLeftButton:@""];
    
    [self createTopView];
    [self setFieldLimt];
    
}
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
}
- (void)createTopView{
    //    WS(ws);
    CGRect rcFrame = CGRectMake(0, kTopHeight, [[UIScreen mainScreen] bounds].size.width, 0);
    FlexFrameView  *header = [[FlexFrameView alloc] initWithFlex:@"WalletTiXianView" Frame:rcFrame Owner:self];
    header.flexibleHeight = YES;


    [header layoutIfNeeded];
    [self.view addSubview:header];
}

- (void)setFieldLimt{
    self.tfTiXianMoney.maxLength = 10;
    self.tfTiXianMoney.textFieldType = CJTextFieldStringTypeMoneyValue;
}

- (void)touchSureTiXianAction{
    
    if ([CJControl getIsEmpty:self.tfTiXianMoney.text]) {
        [CJAlert showStringDismissWithDelay:self.tfTiXianMoney.placeholder];
    }else if([self.tfTiXianMoney.text floatValue] <= 0){
        [[[AFViewShaker alloc] initWithView:self.tfTiXianMoney] shakeWithDuration:[ShakerTime floatValue] completion:^{
            [CJAlert showStringDismissWithDelay:@"提现金额不能少于0"];
        }];
    }else{
        NSString *strURL = CJStringWithFormat(@"%@/ntocc-tms-api/arpaWithdraw" ,CJBaseUrl);
        NSMutableDictionary *dic = [NSMutableDictionary dictionary];
        [dic setValue:self.tfTiXianMoney.text forKey:@"transferAmount"];
        [dic setValue:[CJControl getThreeUnaryValueStr:self.tvRemark.text] forKey:@"memo"];
        [dic setValue:self.typeStr forKey:@"accountType"];
        WS(ws);
        [[HDNetworking sharedHDNetworking] dataTaskWithHTTPMethod:PostType url:strURL parameters:dic status:OperationTip success:^(id  _Nonnull responseObject) {
            [ws pop];
        } failure:^(NSError * _Nonnull error) {
            
        }];
    }
    
}


@end
